﻿/// <reference path="F:\Html5 Game\Game project\js\libs\kangax-fabric-48.306.js"/>
/// <reference path="F:\Html5 Game\Game project\js\classes\DBAbstractionLayer.js"/>
/// <reference path="F:\Html5 Game\Game project\js\classes\GameCanvas.js"/>
/// <reference path="F:\Html5 Game\Game project\js\classes\Node.js"/>
/// <reference path="F:\Html5 Game\Game project\js\classes\NodeType.js"/>
/// <reference path="F:\Html5 Game\Game project\js\classes\Planet.js"/>
/// <reference path="F:\Html5 Game\Game project\js\classes\Region.js"/>
/// <reference path="F:\Html5 Game\Game project\js\classes\Scale.js"/>
/// <reference path="F:\Html5 Game\Game project\js\classes\System.js"/>
/// <reference path="F:\Html5 Game\Game project\js\classes\Universe.js"/>
/// <reference path="F:\Html5 Game\Game project\js\classes\Utilities.js"/>
this.DBAbstractionLayer = function () { // This Faker fakes a DB connection! lolz
    //This data will be fetched from the backend database ofc, this is just temporary.

    //Verwijzingen
    var obj = this;

    //Variabelen

    //Constructor
    var _constructor = function () {
    }

    //Public functies
    obj.getUniverses = function (regions) {
        var universe = new Universe("Anathema", regions);
        return universe;
    }

    obj.getNodes = function () {
        //var tmp = circlepointgenerator(20, 100); //unstable still, fix for weird numbers plz
        var nodes = new Array();
        nodes.push(new Node(NodeType.METAL, new Coordinate(-150, -20)));
        nodes.push(new Node(NodeType.ENERGY, new Coordinate(0, 0)));
        nodes.push(new Node(NodeType.DEUTERIUM, new Coordinate(0, -150)));
        return nodes;
    }

    obj.getPlanets = function () {
        var planets = new Array();
        planets.push(new Planet("planet1", new Coordinate(10, 10), obj.getNodes()));
        planets.push(new Planet("planet2", new Coordinate(100, 100), obj.getNodes()));
        return planets;
    }

    obj.getSystems = function () {
        var systems = new Array();
        systems.push(new System("Voldorius", new Coordinate(10, 10), obj.getPlanets()));
        systems.push(new System("Raphael", new Coordinate(100, 100), obj.getPlanets()));
        systems.push(new System("Loken", new Coordinate(150, 100), obj.getPlanets()));
        return systems;
    }

    obj.getRegions = function () {
        var regions = new Array();
        var regionAlphariusCoords = new Array();
        //First one is always moveto, since otherwise canvas will draw from where it was
        regionAlphariusCoords.push(new Coordinate(10, 10));
        regionAlphariusCoords.push(new Coordinate(100, 10));
        regionAlphariusCoords.push(new Coordinate(100, 100));
        regionAlphariusCoords.push(new Coordinate(10, 100));
        //regionAlphariusCoords.push(new fabric.Point(10, 10));
        var regionAlpharius = new Region(regionAlphariusCoords, "Alpharius", obj.getSystems());
        regions.push(regionAlpharius);
        return regions;
    }

    //Private Functies
    _constructor();
};